# 26. 删除有序数组中的重复项
# 使用快慢指针的方式
def removeDuplicates(nums: list):
    """
    :type nums: List[int]
    :rtype: int
    """
    slow_index = 0
    fast_index = 1
    while fast_index < len(nums):
        if nums[slow_index] != nums[fast_index]:
            slow_index += 1
            nums[slow_index] = nums[fast_index]
        fast_index += 1
    return slow_index + 1


nums_1 = [1, 2, 2, 3, 3, 4, 5, 7, 8, 8]
result = removeDuplicates(nums_1)
print(f"nums_1:{nums_1} , result:{result}")
